/*正则表达式*/


//构造函数
let reg:RegExp = new RegExp("mayouchen");
let reg1:RegExp = new RegExp("mayouchen",'gi');

console.log('reg',reg);
console.log('reg1',reg1);

//字面量声明

let reg2:RegExp = /mayouchen/;
let reg3:RegExp = /mayouchen/gi;


//常用方法   test()  exec()
let reg4:RegExp = /mayouchen/gi;
let reg5:RegExp = /boy/i;
let name1:string = 'mayouchen is a good boy!';

let result1:boolean  = reg4.test(name1);


console.log(result1,"find the mayouchen");
console.log(reg5.exec(name1),"执行喔");